Skip to content

fix(route/latepost): include cover image and abstract in description - #23121

Open
esonwong wants to merge 1 commit into
DIYgod:masterfrom
esonwong:fix/latepost-cover-image
Open

fix(route/latepost): include cover image and abstract in description#23121
esonwong wants to merge 1 commit into
DIYgod:masterfrom
esonwong:fix/latepost-cover-image

Conversation

@esonwong

Copy link
Copy Markdown

Involved Issue / 该 PR 相关 Issue

Close #

Example for the Proposed Route(s) / 路由地址示例

/latepost
/latepost/1
/latepost/2
/latepost/3
/latepost/4

New RSS Route Checklist / 新 RSS 路由检查表

  • New Route / 新的路由
  • Anti-bot or rate limit / 反爬/频率限制
    • If yes, do your code reflect this sign? / 如果有, 是否有对应的措施?
  • Date and time / 日期和时间
    • Parsed / 可以解析
    • Correct time zone / 时区正确
  • New package added / 添加了新的包
  • Puppeteer

Note / 说明

This is a fix to an existing route, not a new one — the checklist above is left blank on purpose.

What was wrong

item.description is built from #select-main, which is the article body only. The cover image sits outside it, in a sibling block, so feed items never included it even though nearly every recent article has one.

The two layouts

The site uses different markup depending on the column:

Column Cover markup
晚点独家 / 长报道 (proma 1, 4) <img id="abstract_img"> inside .abstract
人物访谈 (proma 2) <img class="interview-pic">
晚点早知道 (proma 3) no cover at all

Handling only the first selector would have missed every interview, so the patch tries both and then falls back to the var imgUrl share image declared in the page script, which is present exactly when a cover exists and absent otherwise.

Scheme upgrade

The cover is served as http://www.latepost.com/uploads/cover/... while the body images use https. Readers rendering the item over https may refuse the mixed content, so the scheme is upgraded. The body images are unaffected.

Abstract

The one-line abstract shown next to the cover (.abstract-pic-left) was dropped as well; it is now prepended as a <blockquote>.

Verification

Checked against saved copies of 11 real articles spanning all four columns:

  • 晚点独家 / 长报道 — cover found via #abstract_img
  • 人物访谈 — cover found via img.interview-pic
  • 晚点早知道 — no cover in the source, correctly left empty rather than emitting a broken <img>

Articles that genuinely have no cover produce the same description as before.

The article body selector `#select-main` excludes the cover image, which
the site renders in a sibling block. As a result feed items never carried
the cover, even though every recent exclusive and long read has one.

Pick it up from `#abstract_img` (exclusives, long reads) or
`img.interview-pic` (interviews), falling back to the share image declared
in the page script so both layouts are covered. The site serves these over
plain http, so upgrade the scheme — readers on https tend to refuse mixed
content. Articles genuinely without a cover, such as those in the 晚点早知道
column, are left untouched.

Also prepend the one-line abstract that accompanies the cover, which was
likewise dropped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the route label Aug 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Auto Review

  • [Code Style — JSX rendering for custom HTML] lib/routes/latepost/index.ts:104-108: the new cover/abstract markup is assembled by string concatenation (`<img src="${...}">`, `<blockquote>${abstract}</blockquote>`) instead of RSSHub's JSX template convention. This is also a correctness risk: abstract comes from .text(), so any <, & or quote in the abstract is injected unescaped into the description.
    Fix: add lib/routes/latepost/templates/description.tsx exporting a component that takes cover, abstract and content, and build the description with renderToString(<Description ... />) (see lib/routes/163/templates/exclusive.tsx or lib/routes/0xxx/templates/description.tsx for the pattern). JSX escapes interpolated text automatically.

@github-actions github-actions Bot added the auto: not ready to review Users can't get the RSS feed output according to automated testing results label Aug 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/latepost - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>FetchError: [GET] &quot;https://www.latepost.com/site/get-column&quot;: &lt;no response&gt; fetch failed (unable to get local issuer certificate)
Route: /latepost/:proma?
Full Route: /latepost
Node Version: v24.20.0
Git Hash: 4fbd647e
http://localhost:1200/latepost/1 - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>FetchError: [GET] &quot;https://www.latepost.com/site/get-column&quot;: &lt;no response&gt; fetch failed (unable to get local issuer certificate)
Route: /latepost/:proma?
Full Route: /latepost/1
Node Version: v24.20.0
Git Hash: 4fbd647e
http://localhost:1200/latepost/2 - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>FetchError: [GET] &quot;https://www.latepost.com/site/get-column&quot;: &lt;no response&gt; fetch failed (unable to get local issuer certificate)
Route: /latepost/:proma?
Full Route: /latepost/2
Node Version: v24.20.0
Git Hash: 4fbd647e
http://localhost:1200/latepost/3 - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>FetchError: [GET] &quot;https://www.latepost.com/site/get-column&quot;: &lt;no response&gt; fetch failed (unable to get local issuer certificate)
Route: /latepost/:proma?
Full Route: /latepost/3
Node Version: v24.20.0
Git Hash: 4fbd647e
http://localhost:1200/latepost/4 - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>FetchError: [GET] &quot;https://www.latepost.com/site/get-column&quot;: &lt;no response&gt; fetch failed (unable to get local issuer certificate)
Route: /latepost/:proma?
Full Route: /latepost/4
Node Version: v24.20.0
Git Hash: 4fbd647e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto: not ready to review Users can't get the RSS feed output according to automated testing results route

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant